<template>
	<div>
		<HomeSwiper v-if="this.swiperData.length>0" :list="swiperData[0].data"></HomeSwiper>
		<Commontitle v-if="this.oneImageData.length>0" :imgUrl="oneImageData[0].data[0].img_url" :h5_url="oneImageData[0].data[0].h5_url"></Commontitle>
		<ImgList v-if="this.manyImageData.length>0" :imgList="manyImageData[0]" :type="0"></ImgList>
		<ImgList v-if="this.manyImageData.length>0" :imgList="manyImageData[1]" :type="0"></ImgList>
		<ImgList v-if="this.couponData.length>0" :imgList="couponData[0]" :type="1"></ImgList>
		<Seckill class="seckill" v-if="this.seckillData.length>0" :seckillData="seckillData[0]"></Seckill>
		<Commontitle v-if="this.oneImageData.length>0" :imgUrl="oneImageData[1].data[0].img_url" :h5_url="oneImageData[1].data[0].h5_url"></Commontitle>
		<ImgList v-if="this.manyImageData.length>0" :imgList="manyImageData[2]" :type="0"></ImgList>
		<ImgList v-if="this.manyImageData.length>0" :imgList="manyImageData[3]" :type="0"></ImgList>
		<div v-for="(item,index) of specialCampData" :key="index">
			<GoodsListX :goodsXData="item.data[0]"></GoodsListX>
		</div>
		<GoodsListY v-if="this.productTwoData.length>0" :goodsYData="productTwoData[0]"></GoodsListY>
	</div>
</template>
<script>
import HomeSwiper from '../../components/swiper.vue'
import Commontitle from '../../components/title.vue'
import ImgList from '../../components/imgList.vue'
import Seckill from '../../components/seckill.vue'
import GoodsListX from '../../components/goodsListX.vue'
import GoodsListY from '../../components/goodsListY.vue'

export default{
	name:'recommend',
	data(){
		return{
			swiperData:[],
			oneImageData:[],
			manyImageData:[],
			couponData:[],
			seckillData:[],
			specialCampData:[],
			productTwoData:[]
		}
	},
	props:{
		pageData:Array
	},
	components:{
		HomeSwiper,Commontitle,ImgList,Seckill,GoodsListX,GoodsListY
	},
	created(){
		
	},
	mounted(){

	},
	watch:{
		pageData(e){
			for(var Singledata of e){
				switch(Singledata.template_id){
				 	case 'new_carousel'://轮播
						this.swiperData.push(Singledata)
						break
					case 'new_banner_1image':
						this.oneImageData.push(Singledata)
						break
					case 'new_more_image':
						this.manyImageData.push(Singledata)
						break
					case 'new_banner_2image':
						this.couponData.push(Singledata)
						break
					case 'new_limited':
						this.seckillData.push(Singledata)
						break
					case 'new_special_camp':
						this.specialCampData.push(Singledata)
						break
					case 'new_like_group_product_two':
						this.productTwoData.push(Singledata)
						break
				}
			}
		}
	}
}
</script>
<style lang="stylus" scoped>
.seckill{margin-top:10px;}
</style>